<?php
/*
 * 公共入口文件
 */


//框架版本
define("VER","1.0");
// 系统常量定义
$patc = str_replace("\\","/",__DIR__);
//系统根目录
define("ROOT_PATH",dirname($patc));
//框架核心目录
define('HAPPYPHP_PATH', ROOT_PATH . "/HAPPYPHP");
define("CONFIG_PATH",HAPPYPHP_PATH . "/Config");
define("DATA_PATH",HAPPYPHP_PATH . "/Data");
define("LIB_PATH",HAPPYPHP_PATH . "/Lib");
define("CORE_PATH",LIB_PATH . "/Core");
define("ORG_PATH",LIB_PATH . "/Org");
define("FUNCTION_PATH",LIB_PATH . "/Function");
//应用目录
define("APP_PATH",ROOT_PATH . "/" .APP_NAME);
define("APP_CONFIG_PATH",APP_PATH . "/Config");
define("APP_CONTROLLER_PATH",APP_PATH . "/Controller");
define("APP_VIEW_PATH",APP_PATH . "/View");
define("APP_PUBLIC_PATH",APP_PATH . "/Public");

//公共目录
define("PUBLIC_PATH",ROOT_PATH . "/Public");
define("UPLOADS_PATH",ROOT_PATH . "/Uploads");
//运行时文件
define("RUNTIME_PATH",ROOT_PATH . "/Runtime");


//创建文件
$arr=[
    APP_PATH,
    APP_CONFIG_PATH,
    APP_CONTROLLER_PATH,
    APP_VIEW_PATH,
    APP_PUBLIC_PATH,
    PUBLIC_PATH,
    UPLOADS_PATH,
    RUNTIME_PATH
];

foreach ($arr as $v){
    is_dir($v) or  mkdir($v, 0777, true);
}


//框架所需文件
$arr=[
    FUNCTION_PATH . "/function.php",
    CORE_PATH . "/Controller.class.php",
    CORE_PATH . "/App.class.php",
    CORE_PATH . "/Model.class.php",
];

foreach ($arr as $v){
    require_once $v;
}



// 执行
App::run();